/*************************************************************************
    > File Name: myfile.c
    > Author: ma6174
    > Mail: ma6174@163.com 
    > Created Time: Sun 02 Nov 2025 08:58:50 AM CST
 ************************************************************************/

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>


int main()
{
	int fd = open("log.txt",O_RDONLY);
	dup2(fd,0);
	
	char buffer[2048];
	size_t s = read(0,buffer,sizeof(buffer));
	if(s > 0)
	{
		buffer[s - 1] = 0;
		printf("stdin redir:\n%s\n",buffer);
	}
	
	return 0;
}

